package com.example.supermonkeysm.security.filter;

import com.example.supermonkeysm.utils.Result;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;

import java.io.IOException;

public class NoPermission implements AccessDeniedHandler {
    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException {
        Result.customResult(response,HttpServletResponse.SC_FORBIDDEN,"您无权访问,请联系管理员开通相关权限!");
    }
}
